﻿@using BonjourQuotation.UI.Models.PartialModel
@using MvcCheckBoxList
@model OperationMiscGridViewModel
@{
    Layout = null;

}
<script type="text/javascript">
    var MiscModel;
    var SelectedMiscGridData = [];
    var MiscOldDate = [];
    debugger;
    LoadMiscGrid(false);
    function LoadMiscGrid(IsMiscClientLoad) {
        if (!IsMiscClientLoad)
            MiscModel = $(@Html.Raw(Json.Encode(Model))).JSModel();
        var Misccolumns = [];
        var MisccolWidth = [];
        var MisccolOrder = [];
        var MisccolumnHeaders = [];
        var MiscEmpdrop = [];
        var MiscVnStatusDrop = [];
        var MiscCurrencydrop = ["USD", "CAD"];
        var MiscVendorNamedrop = [];
        var MiscPaymentMethoddrop = [];
        var MiscDetaildrop = [];
        // MiscDateOldDate
        $(MiscModel[0].Rows).each(function (index, elem) {
            MiscOldDate.push(elem.MiscDate);
        });
        $(MiscModel[0].Employee).each(function (index, elem) {
            MiscEmpdrop.push(elem.Text);
        });
        $(MiscModel[0].PaymentMethod).each(function (index, elem) {
            MiscPaymentMethoddrop.push(elem.Text);
        });
        $(MiscModel[0].VendorInfo).each(function (index, elem) {
            MiscVendorNamedrop.push(elem.VendorName);
        });
        $(MiscModel[0].VendorStatus).each(function (index, elem) {
            MiscVnStatusDrop.push(elem.Text);
        });
        $(MiscModel[0].Details).each(function (index, elem) {
            MiscDetaildrop.push(elem.Text);
        });
        if (MiscModel[0].OperationMiscPlaneView) {
            if (MiscModel[0].ViewMiscPlane == true) {
                MisccolumnHeaders.push($("#MiscPlaneDiv").html());
                MiscModel[0].OperationMiscPlaneEdit ? Misccolumns.push({ data: "MiscPlane", type: "checkbox" }) : Misccolumns.push({ data: "MiscPlane", type: "checkbox", readOnly: true });
                MisccolWidth.push(70);
                MisccolOrder.push(MiscModel[0].OperationMiscPlaneLineNo);
                $("#MiscGridMiscPlaneDiv").hide();
            }
            else
                $("#MiscGridMiscPlaneDiv").show();
        }
        if (MiscModel[0].OperationMiscIsCompView) {
            if (MiscModel[0].ViewMiscIsComp == true) {
                MisccolumnHeaders.push($("#MiscIsCompDiv").html());
                MiscModel[0].OperationMiscIsCompEdit ? Misccolumns.push({ data: "MiscIsComp", type: "checkbox" }) : Misccolumns.push({ data: "MiscIsComp", type: "checkbox", readOnly: true });
                MisccolWidth.push(90);
                MisccolOrder.push(MiscModel[0].OperationMiscIsCompLineNo);
                $("#MiscGridMiscIsCompDiv").hide();
            }
            else
                $("#MiscGridMiscIsCompDiv").show();
        }
        if (MiscModel[0].OperationMiscGroupCodeView) {
            if (MiscModel[0].ViewMiscGroupCode == true) {
                MisccolumnHeaders.push($("#MiscGroupCodeDiv").html());
                MiscModel[0].OperationMiscGroupCodeEdit ? Misccolumns.push({ data: "MiscGroupCode", type: "text" }) : Misccolumns.push({ data: "MiscGroupCode", type: "text", readOnly: true });
                MisccolWidth.push(130);
                MisccolOrder.push(MiscModel[0].OperationMiscGroupCodeLineNo);
                $("#MiscGridMiscGroupCodeDiv").hide();
            }
            else
                $("#MiscGridMiscGroupCodeDiv").show();
        }
        //
        if (MiscModel[0].OperationMiscDetailsView) {
            if (MiscModel[0].ViewMiscConfHtml == true) {
                MisccolumnHeaders.push($("#MiscConfHtmlDiv").html());
                Misccolumns.push({ data: "MiscConfHtml", renderer: "html" });
                MisccolWidth.push(80);
                MisccolOrder.push(MiscModel[0].OperationMiscDetailsLineNo);
                $("#MiscGridMiscConfHtmlDiv").hide();
            }
            else
                $("#MiscGridMiscConfHtmlDiv").show();
        }
        if (MiscModel[0].OperationMiscGroupNameView) {
            if (MiscModel[0].ViewMiscGroupName == true) {
                MisccolumnHeaders.push($("#MiscGroupNameDiv").html());
                MiscModel[0].OperationMiscGroupNameEdit ? Misccolumns.push({ data: "MiscGroupName", type: "text" }) : Misccolumns.push({ data: "MiscGroupName", type: "text", readOnly: true });
                MisccolWidth.push(200);
                MisccolOrder.push(MiscModel[0].OperationMiscGroupNameLineNo);
                $("#MiscGridMiscGroupNameDiv").hide();
            }
            else
                $("#MiscGridMiscGroupNameDiv").show();
        }
        if (MiscModel[0].OperationMiscCustomerView) {
            if (MiscModel[0].ViewMiscCustomer == true) {
                MisccolumnHeaders.push($("#MiscCustomerDiv").html());
                MiscModel[0].OperationMiscCustomerEdit ? Misccolumns.push({ data: "MiscCustomer", type: "text" }) : Misccolumns.push({ data: "MiscCustomer", type: "text", readOnly: true });
                MisccolWidth.push(180);
                MisccolOrder.push(MiscModel[0].OperationMiscCustomerLineNo);
                $("#MiscGridMiscCustomerDiv").hide();
            }
            else
                $("#MiscGridMiscCustomerDiv").show();
        }
        ////
        if (MiscModel[0].OperationMiscEmployeeView) {
            if (MiscModel[0].ViewMiscEmployee == true) {
                MisccolumnHeaders.push($("#MiscEmployeeDiv").html());
                MiscModel[0].OperationMiscEmployeeEdit ? Misccolumns.push({ data: "MiscSelectedEmployee", type: "dropdown", source: MiscEmpdrop }) : Misccolumns.push({ data: "MiscSelectedEmployee", type: "dropdown", source: MiscEmpdrop, readOnly: true });
                MisccolWidth.push(200);
                MisccolOrder.push(MiscModel[0].OperationMiscEmployeeLineNo);
                $("#MiscGridMiscEmployeeDiv").hide();
            }
            else
                $("#MiscGridMiscEmployeeDiv").show();
        }
        if (MiscModel[0].OperationMiscServiceDetailView) {
            if (MiscModel[0].ViewMiscServiceDetail == true) {
                MisccolumnHeaders.push($("#MiscServiceDetailDiv").html());
                MiscModel[0].OperationMiscServiceDetailEdit ? Misccolumns.push({ data: "MiscSelectedDetail", type: "dropdown", source: MiscDetaildrop }) : Misccolumns.push({ data: "MiscSelectedDetail", type: "dropdown", source: MiscDetaildrop, readOnly: true });
                MisccolWidth.push(140);
                MisccolOrder.push(MiscModel[0].OperationMiscServiceDetailLineNo);
                $("#MiscGridMiscServiceDetailDiv").hide();
            }
            else
                $("#MiscGridMiscServiceDetailDiv").show();
        }
        if (MiscModel[0].OperationMiscPaxView) {
            if (MiscModel[0].ViewMiscPax == true) {
                MisccolumnHeaders.push($("#MiscPaxDiv").html());
                MiscModel[0].OperationMiscPaxEdit ? Misccolumns.push({ data: "MiscPax", type: "numeric" }) : Misccolumns.push({ data: "MiscPax", type: "numeric", readOnly: true });
                MisccolWidth.push(90);
                MisccolOrder.push(MiscModel[0].OperationMiscPaxLineNo);
                $("#MiscGridMiscPaxDiv").hide();
            }
            else
                $("#MiscGridMiscPaxDiv").show();
        }
        if (MiscModel[0].OperationMiscEstPaxView) {
            if (MiscModel[0].ViewMiscEstNumberofPerson == true) {
                MisccolumnHeaders.push($("#MiscEstNumberofPersonDiv").html());
                MiscModel[0].OperationMiscEstPaxEdit ? Misccolumns.push({ data: "MiscEstNoOfPerson", type: "numeric" }) : Misccolumns.push({ data: "MiscEstNoOfPerson", type: "numeric", readOnly: true });
                MisccolWidth.push(90);
                MisccolOrder.push(MiscModel[0].OperationMiscEstPaxLineNo);
                $("#MiscGridMiscEstNumberofPersonDiv").hide();
            }
            else
                $("#MiscGridMiscEstNumberofPersonDiv").show();
        }
        if (MiscModel[0].OperationMiscSupplierView) {
            if (MiscModel[0].ViewMiscSupplier == true) {
                MisccolumnHeaders.push($("#MiscSupplierDiv").html());
                MiscModel[0].OperationMiscSupplierEdit ? Misccolumns.push({ data: "MiscSupplier", type: "autocomplete", source: MiscVendorNamedrop, strict: false }) : Misccolumns.push({ data: "MiscSupplier", type: "autocomplete", source: MiscVendorNamedrop, strict: false, readOnly: true });
                MisccolWidth.push(400);
                MisccolOrder.push(MiscModel[0].OperationMiscSupplierLineNo);
                $("#MiscGridMiscSupplierDiv").hide();
            }
            else
                $("#MiscGridMiscSupplierDiv").show();
        }
        if (MiscModel[0].OperationMiscStatusView) {
            if (MiscModel[0].ViewMiscStatus == true) {
                MisccolumnHeaders.push($("#MiscStatusDiv").html());
                MiscModel[0].OperationMiscStatusEdit ? Misccolumns.push({ data: "MiscSelectedVendorStatus", type: "dropdown", source: MiscVnStatusDrop }) : Misccolumns.push({ data: "MiscSelectedVendorStatus", type: "dropdown", source: MiscVnStatusDrop, readOnly: true });
                MisccolWidth.push(140);
                MisccolOrder.push(MiscModel[0].OperationMiscStatusLineNo);
                $("#MiscGridMiscStatusDiv").hide();
            }
            else
                $("#MiscGridMiscStatusDiv").show();
        }
        if (MiscModel[0].OperationMiscCurrencyView) {
            if (MiscModel[0].ViewMiscCurrency == true) {
                MisccolumnHeaders.push($("#MiscCurrencyDiv").html());
                MiscModel[0].OperationMiscCurrencyEdit ? Misccolumns.push({ data: "MiscQuotaCurr", type: "dropdown", source: MiscCurrencydrop }) : Misccolumns.push({ data: "MiscQuotaCurr", type: "dropdown", source: MiscCurrencydrop, readOnly: true });
                MisccolWidth.push(100);
                MisccolOrder.push(MiscModel[0].OperationMiscCurrencyLineNo);
                $("#MiscGridMiscCurrencyDiv").hide();
            }
            else
                $("#MiscGridMiscCurrencyDiv").show();
        }
        if (MiscModel[0].OperationMiscTotalAmountPaidView) {
            if (MiscModel[0].ViewMiscTotalAmountPaid == true) {
                MisccolumnHeaders.push($("#MiscTotalAmountPaidDiv").html());
                MiscModel[0].OperationMiscTotalAmountPaidEdit ? Misccolumns.push({ data: "MiscTotalAmountPaid", type: "numeric", format: '$0,0.00' }) : Misccolumns.push({ data: "MiscTotalAmountPaid", type: "numeric", format: '$0,0.00', readOnly: true });
                MisccolWidth.push(200);
                MisccolOrder.push(MiscModel[0].OperationMiscTotalAmountPaidLineNo);
                $("#MiscGridMiscTotalAmountPaidDiv").hide();
            }
            else
                $("#MiscGridMiscTotalAmountPaidDiv").show();
        }
        if (MiscModel[0].OperationMiscTotalAmountCostView) {
            if (MiscModel[0].ViewMiscTotalCost == true) {
                MisccolumnHeaders.push($("#MiscTotalCostDiv").html());
                MiscModel[0].OperationMiscTotalAmountCostEdit ? Misccolumns.push({ data: "MiscTotalCost", type: "numeric", format: '$0,0.00' }) : Misccolumns.push({ data: "MiscTotalCost", type: "numeric", format: '$0,0.00', readOnly: true });
                MisccolWidth.push(200);
                MisccolOrder.push(MiscModel[0].OperationMiscTotalAmountCostLineNo);
                $("#MiscGridMiscTotalAmountCostDiv").hide();
            }
            else
                $("#MiscGridMiscTotalAmountCostDiv").show();
        }
        if (MiscModel[0].OperationMiscTotalOutAmountView) {
            if (MiscModel[0].ViewMiscOutstandingAmt == true) {
                MisccolumnHeaders.push($("#MiscOutstandingAmtDiv").html());
                MiscModel[0].OperationMiscTotalOutAmountEdit ? Misccolumns.push({ data: "MiscOutstandingAmt", type: "numeric", format: '$0,0.00' }) : Misccolumns.push({ data: "MiscOutstandingAmt", type: "numeric", format: '$0,0.00', readOnly: true });
                MisccolWidth.push(200);
                MisccolOrder.push(MiscModel[0].OperationMiscTotalOutAmountLineNo);
                $("#MiscGridMiscOutstandingAmtDiv").hide();
            }
            else
                $("#MiscGridMiscOutstandingAmtDiv").show();
        }
        //
        if (MiscModel[0].OperationMiscFirstPaymentView) {
            if (MiscModel[0].ViewMiscFirstPayment == true) {
                MisccolumnHeaders.push($("#MiscFirstPaymentDiv").html());
                MiscModel[0].OperationMiscFirstPaymentEdit ? Misccolumns.push({ data: "MiscFirstPayment", type: "numeric", format: '$0,0.00' }) : Misccolumns.push({ data: "MiscFirstPayment", type: "numeric", format: '$0,0.00', readOnly: true });
                MisccolWidth.push(130);
                MisccolOrder.push(MiscModel[0].OperationMiscFirstPaymentLineNo);
                $("#MiscFirstPaymentDiv").hide();
            }
            else
                $("#MiscFirstPaymentDiv").show();
        }
        //
        if (MiscModel[0].OperationMiscFirstPaymentMethodView) {
            if (MiscModel[0].ViewMiscSelectedFirstPaymentMethod == true) {
                MisccolumnHeaders.push($("#MiscFirstPaymentMethodDiv").html());
                MiscModel[0].OperationMiscFirstPaymentMethodEdit ? Misccolumns.push({ data: "MiscSelectedFirstPaymentMethod", type: "dropdown", source: MiscPaymentMethoddrop }) : Misccolumns.push({ data: "MiscSelectedFirstPaymentMethod", type: "dropdown", source: MiscPaymentMethoddrop, readOnly: true });
                MisccolWidth.push(160);
                MisccolOrder.push(MiscModel[0].OperationMiscFirstPaymentMethodLineNo);
                $("#MiscFirstPaymentMethodDiv").hide();
            }
            else
                $("#MiscFirstPaymentMethodDiv").show();
        }
        if (MiscModel[0].OperationMiscFirstPaymentDetailsView) {
            MisccolumnHeaders.push($("#MiscPayMeth1FormHtmlDiv").html());
            Misccolumns.push({ data: "MiscPayMeth1FormHtml", renderer: "html" });
            MisccolWidth.push(120);
            MisccolOrder.push(MiscModel[0].OperationMiscFirstPaymentDetailsLineNo);
        }
        //
        if (MiscModel[0].OperationMiscDateofFirstPaymentView) {
            if (MiscModel[0].ViewMiscDateFirstPayment == true) {
                MisccolumnHeaders.push($("#MiscDateFirstPaymentDiv").html());
                MiscModel[0].OperationMiscDateofFirstPaymentEdit ? Misccolumns.push({ data: "MiscDateFirstPayment", type: "date", dateFormat: 'D, dd/M/yy' }) : Misccolumns.push({ data: "MiscDateFirstPayment", type: "date", dateFormat: 'D, dd/M/yy', readOnly: true });
                MisccolWidth.push(160);
                MisccolOrder.push(MiscModel[0].OperationMiscDateofFirstPaymentLineNo);
                $("#MiscDateFirstPaymentDiv").hide();
            }
            else
                $("#MiscDateFirstPaymentDiv").show();
        }
        if (MiscModel[0].OperationMiscSecondPaymentView) {
            if (MiscModel[0].ViewMiscSecondPayment == true) {
                MisccolumnHeaders.push($("#MiscSecondPaymentDiv").html());
                MiscModel[0].OperationMiscSecondPaymentEdit ? Misccolumns.push({ data: "MiscSecondPayment", type: "numeric", format: '$0,0.00' }) : Misccolumns.push({ data: "MiscSecondPayment", type: "numeric", format: '$0,0.00', readOnly: true });
                MisccolWidth.push(130);
                MisccolOrder.push(MiscModel[0].OperationMiscSecondPaymentLineNo);
                $("#MiscSecondPaymentDiv").hide();
            }
            else
                $("#MiscSecondPaymentDiv").show();
        }
        //
        if (MiscModel[0].OperationMiscSecondPaymentMethodView) {
            if (MiscModel[0].ViewMiscSelectedSecondPaymentMethod == true) {
                MisccolumnHeaders.push($("#MiscSecondPaymentMethodDiv").html());
                MiscModel[0].OperationMiscSecondPaymentMethodEdit ? Misccolumns.push({ data: "MiscSelectedSecondPaymentMethod", type: "dropdown", source: MiscPaymentMethoddrop }) : Misccolumns.push({ data: "MiscSelectedSecondPaymentMethod", type: "dropdown", source: MiscPaymentMethoddrop, readOnly: true });
                MisccolWidth.push(160);
                MisccolOrder.push(MiscModel[0].OperationMiscSecondPaymentMethodLineNo);
                $("#MiscSecondPaymentMethodDiv").hide();
            }
            else
                $("#MiscSecondPaymentMethodDiv").show();
        }
        if (MiscModel[0].OperationMiscSecondPaymentDetailsView) {
            MisccolumnHeaders.push($("#MiscPayMeth2FormHtmlDiv").html());
            Misccolumns.push({ data: "MiscPayMeth2FormHtml", renderer: "html" });
            MisccolWidth.push(120);
            MisccolOrder.push(MiscModel[0].OperationMiscSecondPaymentDetailsLineNo);
        }
        //
        if (MiscModel[0].OperationMiscDateofSecondPaymentView) {
            if (MiscModel[0].ViewMiscDateSecondPayment == true) {
                MisccolumnHeaders.push($("#MiscDateSecondPaymentDiv").html());
                MiscModel[0].OperationMiscDateofSecondPaymentEdit ? Misccolumns.push({ data: "MiscDateSecondPayment", type: "date", dateFormat: 'D, dd/M/yy' }) : Misccolumns.push({ data: "MiscDateSecondPayment", type: "date", dateFormat: 'D, dd/M/yy', readOnly: true });
                MisccolWidth.push(160);
                MisccolOrder.push(MiscModel[0].OperationMiscDateofSecondPaymentLineNo);
                $("#MiscDateSecondPaymentDiv").hide();
            }
            else
                $("#MiscDateSecondPaymentDiv").show();
        }
        if (MiscModel[0].OperationMiscThirdPaymentView) {
            if (MiscModel[0].ViewMiscThirdPayment == true) {
                MisccolumnHeaders.push($("#MiscThirdPaymentDiv").html());
                MiscModel[0].OperationMiscThirdPaymentEdit ? Misccolumns.push({ data: "MiscThirdPayment", type: "numeric", format: '$0,0.00' }) : Misccolumns.push({ data: "MiscThirdPayment", type: "numeric", format: '$0,0.00', readOnly: true });
                MisccolWidth.push(130);
                MisccolOrder.push(MiscModel[0].OperationMiscThirdPaymentLineNo);
                $("#MiscThirdPaymentDiv").hide();
            }
            else
                $("#MiscThirdPaymentDiv").show();
        }
        //
        if (MiscModel[0].OperationMiscThirdPaymentMethodView) {
            if (MiscModel[0].ViewMiscSelectedThirdPaymentMethod == true) {
                MisccolumnHeaders.push($("#MiscThirdPaymentMethodDiv").html());
                MiscModel[0].OperationMiscThirdPaymentMethodEdit ? Misccolumns.push({ data: "MiscSelectedThirdPaymentMethod", type: "dropdown", source: MiscPaymentMethoddrop }) : Misccolumns.push({ data: "MiscSelectedThirdPaymentMethod", type: "dropdown", source: MiscPaymentMethoddrop, readOnly: true });
                MisccolWidth.push(160);
                MisccolOrder.push(MiscModel[0].OperationMiscThirdPaymentMethodLineNo);
                $("#MiscThirdPaymentMethodDiv").hide();
            }
            else
                $("#MiscThirdPaymentMethodDiv").show();
        }
        if (MiscModel[0].OperationMiscThirdPaymentDetailsView) {
            MisccolumnHeaders.push($("#MiscPayMeth3FormHtmlDiv").html());
            Misccolumns.push({ data: "MiscPayMeth3FormHtml", renderer: "html" });
            MisccolWidth.push(120);
            MisccolOrder.push(MiscModel[0].OperationMiscThirdPaymentDetailsLineNo);
        }
        if (MiscModel[0].OperationMiscDateofThirdPaymentView) {
            if (MiscModel[0].ViewMiscDateThirdPayment == true) {
                MisccolumnHeaders.push($("#MiscDateThirdPaymentDiv").html());
                MiscModel[0].OperationMiscDateofThirdPaymentEdit ? Misccolumns.push({ data: "MiscDateThirdPayment", type: "date", dateFormat: 'D, dd/M/yy' }) : Misccolumns.push({ data: "MiscDateThirdPayment", type: "date", dateFormat: 'D, dd/M/yy', readOnly: true });
                MisccolWidth.push(160);
                MisccolOrder.push(MiscModel[0].OperationMiscDateofThirdPaymentLineNo);
                $("#MiscDateThirdPaymentDiv").hide();
            }
            else
                $("#MiscDateThirdPaymentDiv").show();
        }
        if (MiscModel[0].OperationMiscQuotaPriceView) {
            if (MiscModel[0].ViewMiscQuotaPrice == true) {
                MisccolumnHeaders.push($("#MiscQuotaPriceDiv").html());
                MiscModel[0].OperationMiscQuotaPriceEdit ? Misccolumns.push({ data: "MiscQuotaPrice", type: "numeric", format: '$0,0.00' }) : Misccolumns.push({ data: "MiscQuotaPrice", type: "numeric", format: '$0,0.00', readOnly: true });
                MisccolWidth.push(140);
                MisccolOrder.push(MiscModel[0].OperationMiscQuotaPriceLineNo);
                $("#MiscGridMiscQuotaPriceDiv").hide();
            }
            else
                $("#MiscGridMiscQuotaPriceDiv").show();
        }
        if (MiscModel[0].OperationMiscQuotaPerGroupPriceView) {
            if (MiscModel[0].ViewMiscQuotaPerGroupPrice == true) {
                MisccolumnHeaders.push($("#MiscQuotaPerGroupPriceDiv").html());
                MiscModel[0].OperationMiscQuotaPerGroupPriceEdit ? Misccolumns.push({ data: "MiscQuotaPerGroupPrice", type: "numeric", format: '$0,0.00' }) : Misccolumns.push({ data: "MiscQuotaPerGroupPrice", type: "numeric", format: '$0,0.00', readOnly: true });
                MisccolWidth.push(140);
                MisccolOrder.push(MiscModel[0].OperationMiscQuotaPerGroupPriceLineNo);
                $("#MiscGridMiscQuotaPerGroupPriceDiv").hide();
            }
            else
                $("#MiscGridMiscQuotaPerGroupPriceDiv").show();
        }
        if (MiscModel[0].OperationMiscQuotaSupplierView) {
            if (MiscModel[0].ViewMiscQuotaSupplier == true) {
                MisccolumnHeaders.push($("#MiscQuotaSupplierDiv").html());
                MiscModel[0].OperationMiscQuotaSupplierEdit ? Misccolumns.push({ data: "MiscQuotaSupplier", type: "text" }) : Misccolumns.push({ data: "MiscQuotaSupplier", type: "text", readOnly: true });
                MisccolWidth.push(300);
                MisccolOrder.push(MiscModel[0].OperationMiscQuotaSupplierLineNo);
                $("#MiscGridMiscQuotaSupplierDiv").hide();
            }
            else
                $("#MiscGridMiscQuotaSupplierDiv").show();
        }
        if (MiscModel[0].OperationMiscDateView) {
            if (MiscModel[0].ViewMiscDate == true) {
                MisccolumnHeaders.push($("#MiscDateDiv").html());
                MiscModel[0].OperationMiscDateEdit ? Misccolumns.push({ data: "MiscDate", type: "date", dateFormat: 'D, dd/M/yy' }) : Misccolumns.push({ data: "MiscDate", type: "date", dateFormat: 'D, dd/M/yy', readOnly: true });
                MisccolWidth.push(140);
                MisccolOrder.push(MiscModel[0].OperationMiscDateLineNo);
                $("#MiscGridMiscDateDiv").hide();
            }
            else
                $("#MiscGridMiscDateDiv").show();
        }
        if (MiscModel[0].OperationMiscTimeView) {
            if (MiscModel[0].ViewMiscTime == true) {
                MisccolumnHeaders.push($("#MiscTimeDiv").html());
                MiscModel[0].OperationMiscTimeEdit ? Misccolumns.push({ data: "MiscTime", type: "time" }) : Misccolumns.push({ data: "MiscTime", type: "time", readOnly: true });
                MisccolWidth.push(80);
                MisccolOrder.push(MiscModel[0].OperationMiscTimeLineNo);
                $("#MiscGridMiscTimeDiv").hide();
            }
            else
                $("#MiscGridMiscTimeDiv").show();
        }
        if (MiscModel[0].OperationMiscUnitPriceView) {
            if (MiscModel[0].ViewMiscUnitPrice == true) {
                MisccolumnHeaders.push($("#MiscUnitPriceDiv").html());
                MiscModel[0].OperationMiscUnitPriceEdit ? Misccolumns.push({ data: "MiscUnitPrice", type: "numeric", format: '$0,0.00' }) : Misccolumns.push({ data: "MiscUnitPrice", type: "numeric", format: '$0,0.00', readOnly: true });
                MisccolWidth.push(120);
                MisccolOrder.push(MiscModel[0].OperationMiscUnitPriceLineNo);
                $("#MiscGridMiscUnitPriceDiv").hide();
            }
            else
                $("#MiscGridMiscUnitPriceDiv").show();
        }
        if (MiscModel[0].OperationMiscUnitPricePGView) {
            if (MiscModel[0].ViewMiscUnitPricePG == true) {
                MisccolumnHeaders.push($("#MiscUnitPricePGDiv").html());
                MiscModel[0].OperationMiscUnitPricePGEdit ? Misccolumns.push({ data: "MiscUnitPricePG", type: "numeric", format: '$0,0.00' }) : Misccolumns.push({ data: "MiscUnitPricePG", type: "numeric", format: '$0,0.00', readOnly: true });
                MisccolWidth.push(120);
                MisccolOrder.push(MiscModel[0].OperationMiscUnitPricePGLineNo);
                $("#MiscGridMiscUnitPricePGDiv").hide();
            }
            else
                $("#MiscGridMiscUnitPricePGDiv").show();
        }
        if (MiscModel[0].OperationMiscDiffView) {
            if (MiscModel[0].ViewMiscDiff == true) {
                MisccolumnHeaders.push($("#MiscDiffDiv").html());
                MiscModel[0].OperationMiscDiffEdit ? Misccolumns.push({ data: "MiscDiff", type: "numeric", format: '$0,0.00' }) : Misccolumns.push({ data: "MiscDiff", type: "numeric", format: '$0,0.00', readOnly: true });
                MisccolWidth.push(120);
                MisccolOrder.push(MiscModel[0].OperationMiscDiffLineNo);
                $("#MiscGridMiscDiffDiv").hide();
            }
            else
                $("#MiscGridMiscDiffDiv").show();
        }
        if (MiscModel[0].OperationMiscPGDiffView) {
            if (MiscModel[0].ViewMiscPGDiff == true) {
                MisccolumnHeaders.push($("#MiscPGDiffDiv").html());
                MiscModel[0].OperationMiscPGDiffEdit ? Misccolumns.push({ data: "MiscPGDiff", type: "numeric", format: '$0,0.00' }) : Misccolumns.push({ data: "MiscPGDiff", type: "numeric", format: '$0,0.00', readOnly: true });
                MisccolWidth.push(120);
                MisccolOrder.push(MiscModel[0].OperationMiscPGDiffLineNo);
                $("#MiscGridMiscPGDiffDiv").hide();
            }
            else
                $("#MiscGridMiscPGDiffDiv").show();
        }
        if (MiscModel[0].OperationMiscContactView) {
            if (MiscModel[0].ViewMiscContact == true) {
                MisccolumnHeaders.push($("#MiscContactDiv").html());
                MiscModel[0].OperationMiscContactEdit ? Misccolumns.push({ data: "MiscContact", type: "text" }) : Misccolumns.push({ data: "MiscContact", type: "text", readOnly: true });
                MisccolWidth.push(120);
                MisccolOrder.push(MiscModel[0].OperationMiscContactLineNo);
                $("#MiscGridMiscContactDiv").hide();
            }
            else
                $("#MiscGridMiscContactDiv").show();
        }
        if (MiscModel[0].OperationMiscPhoneView) {
            if (MiscModel[0].ViewMiscPhone == true) {
                MisccolumnHeaders.push($("#MiscPhoneDiv").html());
                MiscModel[0].OperationMiscPhoneEdit ? Misccolumns.push({ data: "MiscPhone", type: "text" }) : Misccolumns.push({ data: "MiscPhone", type: "text", readOnly: true });
                MisccolWidth.push(120);
                MisccolOrder.push(MiscModel[0].OperationMiscPhoneLineNo);
                $("#MiscGridMiscPhoneDiv").hide();
            }
            else
                $("#MiscGridMiscPhoneDiv").show();
        }
        if (MiscModel[0].OperationMiscEmailView) {
            if (MiscModel[0].ViewMiscEmail == true) {
                MisccolumnHeaders.push($("#MiscEmailDiv").html());
                MiscModel[0].OperationMiscEmailEdit ? Misccolumns.push({ data: "MiscEmail", type: "text" }) : Misccolumns.push({ data: "MiscEmail", type: "text", readOnly: true });
                MisccolWidth.push(120);
                MisccolOrder.push(MiscModel[0].OperationMiscEmailLineNo);
                $("#MiscGridMiscEmailDiv").hide();
            }
            else
                $("#MiscGridMiscEmailDiv").show();
        }
        if (MiscModel[0].OperationMiscAddressView) {
            if (MiscModel[0].ViewMiscAddress == true) {
                MisccolumnHeaders.push($("#MiscAddressDiv").html());
                MiscModel[0].OperationMiscAddressEdit ? Misccolumns.push({ data: "MiscAddress", type: "text" }) : Misccolumns.push({ data: "MiscAddress", type: "text", readOnly: true });
                MisccolWidth.push(200);
                MisccolOrder.push(MiscModel[0].OperationMiscAddressLineNo);
                $("#MiscGridMiscAddressDiv").hide();
            }
            else
                $("#MiscGridMiscAddressDiv").show();
        }
        if (MiscModel[0].OperationMiscCityView) {
            if (MiscModel[0].ViewMiscCity == true) {
                MisccolumnHeaders.push($("#MiscCityDiv").html());
                MiscModel[0].OperationMiscCityEdit ? Misccolumns.push({ data: "MiscCity", type: "text" }) : Misccolumns.push({ data: "MiscCity", type: "text", readOnly: true });
                MisccolWidth.push(120);
                MisccolOrder.push(MiscModel[0].OperationMiscCityLineNo);
                $("#MiscGridMiscCityDiv").hide();
            }
            else
                $("#MiscGridMiscCityDiv").show();
        }
        if (MiscModel[0].OperationMiscViewGroupContractView) {
            MisccolumnHeaders.push($("#MiscGroupContractHtmlDiv").html());
            Misccolumns.push({ data: "MiscGroupContractHtml", renderer: "html" });
            MisccolWidth.push(150);
            MisccolOrder.push(MiscModel[0].OperationMiscViewGroupContractLineNo);
        }
        if (MiscModel[0].OperationMiscNotesView) {
            if (MiscModel[0].ViewMiscNotes == true) {
                MisccolumnHeaders.push($("#MiscNotesDiv").html());
                MiscModel[0].OperationMiscNotesEdit ? Misccolumns.push({ data: "MiscNotes", type: "text" }) : Misccolumns.push({ data: "MiscNotes", type: "text", readOnly: true });
                MisccolWidth.push(500);
                MisccolOrder.push(MiscModel[0].OperationMiscNotesLineNo);
                $("#MiscGridMiscNotesDiv").hide();
            }
            else
                $("#MiscGridMiscNotesDiv").show();
        }

        for (var ind1 = 0; ind1 < MisccolOrder.length; ind1++)
            for (var ind2 = ind1 + 1; ind2 < MisccolOrder.length; ind2++) {
                if (MisccolOrder[ind2] < MisccolOrder[ind1]) {
                    var ord = MisccolOrder[ind2];
                    MisccolOrder[ind2] = MisccolOrder[ind1];
                    MisccolOrder[ind1] = ord;
                    var Header = MisccolumnHeaders[ind2];
                    MisccolumnHeaders[ind2] = MisccolumnHeaders[ind1];
                    MisccolumnHeaders[ind1] = Header;
                    var Width = MisccolWidth[ind2];
                    MisccolWidth[ind2] = MisccolWidth[ind1];
                    MisccolWidth[ind1] = Width;
                    var Col = Misccolumns[ind2];
                    Misccolumns[ind2] = Misccolumns[ind1];
                    Misccolumns[ind1] = Col;
                }
            }
        MiscRedColorRendererForNegative = function (instance, td, row, col, prop, value, cellProperties) {
            Handsontable.renderers.NumericRenderer.apply(this, arguments);
            td.style.color = 'red';
        };
        var Miscdata = MiscModel[0].Rows;
        var CopyRowStart = null;
        $('#OperMiscGrid').handsontable({
            data: Miscdata,
            minSpareRows: 1,
            colHeaders: MisccolumnHeaders,
            colWidths: MisccolWidth,
            contextMenu: false,
            manualColumnResize: true,
            manualRowResize: true,
            manualColumnMove: true,
            wordWrap: false,
            columns: Misccolumns,
            fixedColumnsLeft: MiscModel[0].OperationMiscFixedColumnCount,
            afterSelectionEnd: function (row1, column1, row2, column2) {
                SelectedMiscGridData.length = 0;
                SelectedMiscGridData.push(row1);
                SelectedMiscGridData.push(row2);
                SelectedMiscGridData.push(column1);
                SelectedMiscGridData.push(column2);
                $("#MiscGetSelected").removeAttr('disabled');
            },
            afterSelectionByProp: function (row1, prop1, row2, prop2) {
                if (prop1 == prop2 && prop1 == "MiscSupplier" && this.getData()[row1].MiscVendorID != null)
                    CopyRowStart = row1;
            },
            afterChange: function (data, source) {
                debugger
                if (data != null) {
                    CheckOperMiscDataChanges();
                    var instance = this;
                    if (data[0][1] == "MiscSupplier" && instance.getData()[data[0][0]].MiscSelectedVendorStatus == "Made") {
                        jAlert("Supplier with Made status can not be changed.", "Warning!");
                        instance.getData()[data[0][0]].MiscSupplier = data[0][2];
                        instance.render();
                    }
                    $(data).each(function (index, elem) {
                        if (elem[1] == "MiscSupplier") {
                            var row = elem[0];
                            var VndElem = MiscGetVendorElemByVendorName(elem[3]);
                            MiscAutoCopyCols(instance, row, VndElem, CopyRowStart);
                            CopyRowStart++;
                        }
                    });
                    instance.render();
                }
            },
            cells: function (row, col, prop) {
                var Cellinstance = this;
                if (Cellinstance.renderer == Handsontable.renderers.NumericRenderer && Cellinstance.instance.getDataAtCell(row, col) < 0) {
                    Cellinstance.renderer = MiscRedColorRendererForNegative;
                }
            }
        });
        if ($("#IsRemoveMiscFilterDivShow").val() == "True") {
            $("#MiscRemoveFiltersDiv").show();
        }
    }
    function MiscGetVendorElemByVendorName(VndName) {
        var Velem = null;
        $(MiscModel[0].VendorInfo).each(function (index, elem) {
            if (elem.VendorName == VndName)
                Velem = elem;
        });
        return Velem;
    }
    function MiscGetVendorElemByVendorID(VendorID) {
        var Velem = null;
        $(MiscModel[0].VendorInfo).each(function (index, elem) {
            if (elem.VendorID == VendorID)
                Velem = elem;
        });
        return Velem;
    }
    function MiscAutoCopyCols(instance, row, VndElem, CopyRowStart) {
        debugger
        // Vendor Info auto copy
        instance.getData()[row].MiscCity = VndElem.VendorCity;
        instance.getData()[row].MiscAddress = VndElem.VendorAddress;
        instance.getData()[row].MiscPhone = VndElem.VendorPhone;
        instance.getData()[row].MiscCategory = VndElem.VendorType;
        instance.getData()[row].MiscEmail = VndElem.VendorEmail;
        instance.getData()[row].MiscContact = VndElem.VendorContactPerson;
        instance.getData()[row].MiscNewVendorID = VndElem.VendorID;
        if (instance.getData()[row].MiscGroupID == null && CopyRowStart != null) {
            // new row
            instance.getData()[row].MiscGroupID = instance.getData()[CopyRowStart].MiscGroupID;
            instance.getData()[row].MiscGroupCode = instance.getData()[CopyRowStart].MiscGroupCode;
            instance.getData()[row].MiscGroupName = instance.getData()[CopyRowStart].MiscGroupName;
            instance.getData()[row].MiscCustomer = instance.getData()[CopyRowStart].MiscCustomer;
            instance.getData()[row].MiscSelectedEmployee = instance.getData()[CopyRowStart].MiscSelectedEmployee;
            instance.getData()[row].MiscSelectedDetail = instance.getData()[CopyRowStart].MiscSelectedDetail;
            instance.getData()[row].MiscPax = instance.getData()[CopyRowStart].MiscPax;
            instance.getData()[row].MiscEstNoOfPerson = instance.getData()[CopyRowStart].MiscEstNoOfPerson;
            instance.getData()[row].MiscSelectedVendorStatus = MiscModel[0].VendorStatus[0].Text;
            instance.getData()[row].MiscDate = instance.getData()[CopyRowStart].MiscDate;
            instance.getData()[row].MiscTime = instance.getData()[CopyRowStart].MiscTime;
            instance.getData()[row].MiscQuotaPrice = instance.getData()[CopyRowStart].MiscQuotaPrice;
            instance.getData()[row].MiscQuotaPerGroupPrice = instance.getData()[CopyRowStart].MiscQuotaPerGroupPrice;
            instance.getData()[row].MiscQuotaSupplier = instance.getData()[CopyRowStart].MiscQuotaSupplier;
            instance.getData()[row].MiscQuotaCurr = instance.getData()[CopyRowStart].MiscQuotaCurr;
        }
    }
    function MiscGetSelectedClick() {
        if ($("#MiscForEmail").length > 0) {
            $("#MiscForEmail").remove();
        }
        //get the instance using jQuery wrapper
        var SelectedMiscGridDataHeaders = [];
        var SelectedMiscElementValues = [];
        if (SelectedMiscGridData[2] > SelectedMiscGridData[3]) {
            var a = SelectedMiscGridData[3];
            SelectedMiscGridData[3] = SelectedMiscGridData[2];
            SelectedMiscGridData[2] = a;

        }
        if (SelectedMiscGridData[0] > SelectedMiscGridData[1]) {
            var a = SelectedMiscGridData[0];
            SelectedMiscGridData[0] = SelectedMiscGridData[1];
            SelectedMiscGridData[1] = a;

        }
        for (var ind = SelectedMiscGridData[2]; ind <= SelectedMiscGridData[3]; ++ind) {
            SelectedMiscGridDataHeaders.push(($('#OperMiscGrid').handsontable('getColHeader', ind)));
        }
        var hadstontabledata = $('#OperMiscGrid').handsontable('getData', SelectedMiscGridData[0], SelectedMiscGridData[2], SelectedMiscGridData[1], SelectedMiscGridData[3]);
        $("#OperMiscGridForm").append("<div id='MiscForEmail' style='Display:None'></div>");

        var table = $('<table></table>');

        var Headercolumn = $("<tr style='border: 1px solid black;border-collapse: collapse'></tr>");
        for (i = 0; i < SelectedMiscGridDataHeaders.length; i++) {
            var Headerrow = $("<td style='border: 1px solid black;border-collapse: collapse;background-color:red;color:white'></td>").html(SelectedMiscGridDataHeaders[i]);
            Headercolumn.append(Headerrow);
            table.append(Headercolumn);
        }
        $(table).find('.MiscGridFilterBtn').each(function () {
            $(this).remove();
        });
        $(table).find('.MiscGridViewBtn').each(function () {
            $(this).remove();
        });
        $(table).find('input').each(function () {
            $(this).remove();
        });
        for (i = 0; i < hadstontabledata.length; i++) {
            var columntr = $("<tr style='border: 1px solid black;border-collapse: collapse'></tr>");
            for (j = 0; j < hadstontabledata[i].length; ++j) {
                var rowtd = $("<td style='border: 1px solid black;border-collapse: collapse'></td>").html(hadstontabledata[i][j]);
                columntr.append(rowtd)
            }
            table.append(columntr);
        }

        $('#MiscForEmail').append(table);
    }
    // Misc Grid column Hide Unhide
    function MiscGridColumnHideUnhide(element) {
        debugger
        var column = $(element).attr('id');
        switch (column) {
            case "MiscGridMiscPlaneView":
                {
                    if (MiscModel[0].ViewMiscPlane == true)
                        MiscModel[0].ViewMiscPlane = false;
                    else
                        MiscModel[0].ViewMiscPlane = true;
                }
                break;
            case "MiscGridMiscIsCompView":
                {
                    if (MiscModel[0].ViewMiscIsComp == true)
                        MiscModel[0].ViewMiscIsComp = false;
                    else
                        MiscModel[0].ViewMiscIsComp = true;
                }
                break;
            case "MiscGridMiscGroupNameView":
                {
                    if (MiscModel[0].ViewMiscGroupName == true)
                        MiscModel[0].ViewMiscGroupName = false;
                    else
                        MiscModel[0].ViewMiscGroupName = true;
                }
                break;
            case "MiscGridMiscGroupCodeView":
                {
                    if (MiscModel[0].ViewMiscGroupCode == true)
                        MiscModel[0].ViewMiscGroupCode = false;
                    else
                        MiscModel[0].ViewMiscGroupCode = true;
                }
                break;
            case "MiscGridMiscConfHtmlView":
                {
                    if (MiscModel[0].ViewMiscConfHtml == true)
                        MiscModel[0].ViewMiscConfHtml = false;
                    else
                        MiscModel[0].ViewMiscConfHtml = true;
                }
                break;
            case "MiscGridMiscCustomerView":
                {
                    if (MiscModel[0].ViewMiscCustomer == true)
                        MiscModel[0].ViewMiscCustomer = false;
                    else
                        MiscModel[0].ViewMiscCustomer = true;
                }
                break;
            case "MiscGridMiscEmployeeView":
                {
                    if (MiscModel[0].ViewMiscEmployee == true)
                        MiscModel[0].ViewMiscEmployee = false;
                    else
                        MiscModel[0].ViewMiscEmployee = true;
                }
                break;
            case "MiscGridMiscServiceDetailView":
                {
                    if (MiscModel[0].ViewMiscServiceDetail == true)
                        MiscModel[0].ViewMiscServiceDetail = false;
                    else
                        MiscModel[0].ViewMiscServiceDetail = true;
                }
                break;
            case "MiscGridMiscPaxView":
                {
                    if (MiscModel[0].ViewMiscPax == true)
                        MiscModel[0].ViewMiscPax = false;
                    else
                        MiscModel[0].ViewMiscPax = true;
                }
                break;
            case "MiscGridMiscEstNumberofPersonView":
                {
                    if (MiscModel[0].ViewMiscEstNumberofPerson == true)
                        MiscModel[0].ViewMiscEstNumberofPerson = false;
                    else
                        MiscModel[0].ViewMiscEstNumberofPerson = true;
                }
                break;
            case "MiscGridMiscSupplierView":
                {
                    if (MiscModel[0].ViewMiscSupplier == true)
                        MiscModel[0].ViewMiscSupplier = false;
                    else
                        MiscModel[0].ViewMiscSupplier = true;
                }
                break;
            case "MiscGridMiscDateView":
                {
                    if (MiscModel[0].ViewMiscDate == true)
                        MiscModel[0].ViewMiscDate = false;
                    else
                        MiscModel[0].ViewMiscDate = true;
                }
                break;
            case "MiscGridMiscTimeView":
                {
                    if (MiscModel[0].ViewMiscTime == true)
                        MiscModel[0].ViewMiscTime = false;
                    else
                        MiscModel[0].ViewMiscTime = true;
                }
                break;
            case "MiscGridMiscUnitPriceView":
                {
                    if (MiscModel[0].ViewMiscUnitPrice == true)
                        MiscModel[0].ViewMiscUnitPrice = false;
                    else
                        MiscModel[0].ViewMiscUnitPrice = true;
                }
                break;
            case "MiscGridMiscUnitPricePGView":
                {
                    if (MiscModel[0].ViewMiscUnitPricePG == true)
                        MiscModel[0].ViewMiscUnitPricePG = false;
                    else
                        MiscModel[0].ViewMiscUnitPricePG = true;
                }
                break;
            case "MiscGridMiscDiffView":
                {
                    if (MiscModel[0].ViewMiscDiff == true)
                        MiscModel[0].ViewMiscDiff = false;
                    else
                        MiscModel[0].ViewMiscDiff = true;
                }
                break;
            case "MiscGridMiscPGDiffView":
                {
                    if (MiscModel[0].ViewMiscPGDiff == true)
                        MiscModel[0].ViewMiscPGDiff = false;
                    else
                        MiscModel[0].ViewMiscPGDiff = true;
                }
                break;
            case "MiscGridMiscContactView":
                {
                    if (MiscModel[0].ViewMiscContact == true)
                        MiscModel[0].ViewMiscContact = false;
                    else
                        MiscModel[0].ViewMiscContact = true;
                }
                break;
            case "MiscGridMiscPhoneView":
                {
                    if (MiscModel[0].ViewMiscPhone == true)
                        MiscModel[0].ViewMiscPhone = false;
                    else
                        MiscModel[0].ViewMiscPhone = true;
                }
                break;
            case "MiscGridMiscEmailView":
                {
                    if (MiscModel[0].ViewMiscEmail == true)
                        MiscModel[0].ViewMiscEmail = false;
                    else
                        MiscModel[0].ViewMiscEmail = true;
                }
                break;
            case "MiscGridMiscAddressView":
                {
                    if (MiscModel[0].ViewMiscAddress == true)
                        MiscModel[0].ViewMiscAddress = false;
                    else
                        MiscModel[0].ViewMiscAddress = true;
                }
                break;
            case "MiscGridMiscCityView":
                {
                    if (MiscModel[0].ViewMiscCity == true)
                        MiscModel[0].ViewMiscCity = false;
                    else
                        MiscModel[0].ViewMiscCity = true;
                }
                break;
            case "MiscGridMiscStatusView":
                {
                    if (MiscModel[0].ViewMiscStatus == true)
                        MiscModel[0].ViewMiscStatus = false;
                    else
                        MiscModel[0].ViewMiscStatus = true;
                }
                break;
            case "MiscGridMiscCurrencyView":
                {
                    if (MiscModel[0].ViewMiscCurrency == true)
                        MiscModel[0].ViewMiscCurrency = false;
                    else
                        MiscModel[0].ViewMiscCurrency = true;
                }
                break;
            case "MiscGridMiscTotalAmountPaidView":
                {
                    if (MiscModel[0].ViewMiscTotalAmountPaid == true)
                        MiscModel[0].ViewMiscTotalAmountPaid = false;
                    else
                        MiscModel[0].ViewMiscTotalAmountPaid = true;
                }
                break;
            case "MiscGridMiscTotalCostView":
                {
                    if (MiscModel[0].ViewMiscTotalCost == true)
                        MiscModel[0].ViewMiscTotalCost = false;
                    else
                        MiscModel[0].ViewMiscTotalCost = true;
                }
                break;
            case "MiscGridMiscOutstandingAmtView":
                {
                    if (MiscModel[0].ViewMiscOutstandingAmt == true)
                        MiscModel[0].ViewMiscOutstandingAmt = false;
                    else
                        MiscModel[0].ViewMiscOutstandingAmt = true;
                }
                break;
            case "MiscGridMiscFirstPaymentView":
                {
                    if (MiscModel[0].ViewMiscFirstPayment == true)
                        MiscModel[0].ViewMiscFirstPayment = false;
                    else
                        MiscModel[0].ViewMiscFirstPayment = true;
                }
                break;
            case "MiscGridMiscFirstPaymentMethodView":
                {
                    if (MiscModel[0].ViewMiscSelectedFirstPaymentMethod == true)
                        MiscModel[0].ViewMiscSelectedFirstPaymentMethod = false;
                    else
                        MiscModel[0].ViewMiscSelectedFirstPaymentMethod = true;
                }
                break;
            case "MiscGridMiscDateFirstPaymentView":
                {
                    if (MiscModel[0].ViewMiscDateFirstPayment == true)
                        MiscModel[0].ViewMiscDateFirstPayment = false;
                    else
                        MiscModel[0].ViewMiscDateFirstPayment = true;
                }
                break;
            case "MiscGridMiscSecondPaymentView":
                {
                    if (MiscModel[0].ViewMiscSecondPayment == true)
                        MiscModel[0].ViewMiscSecondPayment = false;
                    else
                        MiscModel[0].ViewMiscSecondPayment = true;
                }
                break;
            case "MiscGridMiscSecondPaymentMethodView":
                {
                    if (MiscModel[0].ViewMiscSelectedSecondPaymentMethod == true)
                        MiscModel[0].ViewMiscSelectedSecondPaymentMethod = false;
                    else
                        MiscModel[0].ViewMiscSelectedSecondPaymentMethod = true;
                }
                break;
            case "MiscGridMiscDateSecondPaymentView":
                {
                    if (MiscModel[0].ViewMiscDateSecondPayment == true)
                        MiscModel[0].ViewMiscDateSecondPayment = false;
                    else
                        MiscModel[0].ViewMiscDateSecondPayment = true;
                }
                break;
            case "MiscGridMiscThirdPaymentView":
                {
                    if (MiscModel[0].ViewMiscThirdPayment == true)
                        MiscModel[0].ViewMiscThirdPayment = false;
                    else
                        MiscModel[0].ViewMiscThirdPayment = true;
                }
                break;
            case "MiscGridMiscThirdPaymentMethodView":
                {
                    if (MiscModel[0].ViewMiscSelectedThirdPaymentMethod == true)
                        MiscModel[0].ViewMiscSelectedThirdPaymentMethod = false;
                    else
                        MiscModel[0].ViewMiscSelectedThirdPaymentMethod = true;
                }
                break;
            case "MiscGridMiscDateThirdPaymentView":
                {
                    if (MiscModel[0].ViewMiscDateThirdPayment == true)
                        MiscModel[0].ViewMiscDateThirdPayment = false;
                    else
                        MiscModel[0].ViewMiscDateThirdPayment = true;
                }
                break;
            case "MiscGridMiscQuotaPriceView":
                {
                    if (MiscModel[0].ViewMiscQuotaPrice == true)
                        MiscModel[0].ViewMiscQuotaPrice = false;
                    else
                        MiscModel[0].ViewMiscQuotaPrice = true;
                }
                break;
            case "MiscGridMiscQuotaPerGroupPriceView":
                {
                    if (MiscModel[0].ViewMiscQuotaPerGroupPrice == true)
                        MiscModel[0].ViewMiscQuotaPerGroupPrice = false;
                    else
                        MiscModel[0].ViewMiscQuotaPerGroupPrice = true;
                }
                break;
            case "MiscGridMiscQuotaSupplierView":
                {
                    if (MiscModel[0].ViewMiscQuotaSupplier == true)
                        MiscModel[0].ViewMiscQuotaSupplier = false;
                    else
                        MiscModel[0].ViewMiscQuotaSupplier = true;
                }
                break;
            case "MiscGridMiscNotesView":
                {
                    if (MiscModel[0].ViewMiscNotes == true)
                        MiscModel[0].ViewMiscNotes = false;
                    else
                        MiscModel[0].ViewMiscNotes = true;
                }
                break;
            default:
                break;
        }
        LoadMiscGrid(true);
    }
    function CheckOperMiscDataChanges() {
        if (!$("#OperMiscSaveBtn").hasClass("GridDataChanged"))
            $("#OperMiscSaveBtn").addClass("GridDataChanged");
    }
    // Save Misc Grid Data
    function MiscGridSave() {
        debugger;
        var Rows = $('#OperMiscGrid').data('handsontable').getData();
        var SelectedMiscFilterCustomerCode = [];
        $('#MiscGridCustomerCodeMainDiv input[name=SelectedMiscFilterCustomerCode]:checked').each(function () {
            SelectedMiscFilterCustomerCode.push($(this).val());
        });
        var SelectedMiscFilterGroupCode = [];
        $('#MiscGridGroupCodeMainDiv input[name=SelectedMiscFilterGroupCode]:checked').each(function () {
            SelectedMiscFilterGroupCode.push($(this).val());
        });
        var SelectedMiscFilterGroupName = [];
        $('#MiscGridGroupNameMainDiv input[name=SelectedMiscFilterGroupName]:checked').each(function () {
            SelectedMiscFilterGroupName.push($(this).val());
        });
        var SelectedMiscFilterVendorName = [];
        $('#MiscGridVendorNameMainDiv input[name=SelectedMiscFilterVendorName]:checked').each(function () {
            SelectedMiscFilterVendorName.push($(this).val());
        });
        var SelectedMiscFilterVendorCity = [];
        $('#MiscGridVendorCityMainDiv input[name=SelectedMiscFilterVendorCity]:checked').each(function () {
            SelectedMiscFilterVendorCity.push($(this).val());
        });
        var SelectedMiscFilterStatus = [];
        $('#MiscGridStatusMainDiv input[name=SelectedMiscFilterStatus]:checked').each(function () {
            SelectedMiscFilterStatus.push($(this).val());
        });
        var OperationMiscGridViewModel = {
            SaveRows: [],
            // show hide
            ViewMiscPlane: MiscModel[0].ViewMiscPlane,
            ViewMiscIsComp: MiscModel[0].ViewMiscIsComp,
            ViewMiscGroupCode: MiscModel[0].ViewMiscGroupCode,
            ViewMiscConfHtml: MiscModel[0].ViewMiscConfHtml,
            ViewMiscGroupName: MiscModel[0].ViewMiscGroupName,
            ViewMiscCustomer: MiscModel[0].ViewMiscCustomer,
            ViewMiscEmployee: MiscModel[0].ViewMiscEmployee,
            ViewMiscServiceDetail: MiscModel[0].ViewMiscServiceDetail,
            ViewMiscPax: MiscModel[0].ViewMiscPax,
            ViewMiscEstNumberofPerson: MiscModel[0].ViewMiscEstNumberofPerson,
            ViewMiscSupplier: MiscModel[0].ViewMiscSupplier,
            ViewMiscStatus: MiscModel[0].ViewMiscStatus,
            ViewMiscCurrency: MiscModel[0].ViewMiscCurrency,
            ViewMiscTotalAmountPaid: MiscModel[0].ViewMiscTotalAmountPaid,
            ViewMiscTotalCost: MiscModel[0].ViewMiscTotalCost,
            ViewMiscOutstandingAmt: MiscModel[0].ViewMiscOutstandingAmt,
            ViewMiscFirstPayment: MiscModel[0].ViewMiscFirstPayment,
            ViewMiscSelectedFirstPaymentMethod: MiscModel[0].ViewMiscSelectedFirstPaymentMethod,
            ViewMiscDateFirstPayment: MiscModel[0].ViewMiscDateFirstPayment,
            ViewMiscSecondPayment: MiscModel[0].ViewMiscSecondPayment,
            ViewMiscSelectedSecondPaymentMethod: MiscModel[0].ViewMiscSelectedSecondPaymentMethod,
            ViewMiscDateSecondPayment: MiscModel[0].ViewMiscDateSecondPayment,
            ViewMiscThirdPayment: MiscModel[0].ViewMiscThirdPayment,
            ViewMiscSelectedThirdPaymentMethod: MiscModel[0].ViewMiscSelectedThirdPaymentMethod,
            ViewMiscDateThirdPayment: MiscModel[0].ViewMiscDateThirdPayment,
            ViewMiscQuotaPrice: MiscModel[0].ViewMiscQuotaPrice,
            ViewMiscQuotaPerGroupPrice: MiscModel[0].ViewMiscQuotaPerGroupPrice,
            ViewMiscQuotaSupplier: MiscModel[0].ViewMiscQuotaSupplier,
            ViewMiscDate: MiscModel[0].ViewMiscDate,
            ViewMiscTime: MiscModel[0].ViewMiscTime,
            ViewMiscUnitPrice: MiscModel[0].ViewMiscUnitPrice,
            ViewMiscUnitPricePG: MiscModel[0].ViewMiscUnitPricePG,
            ViewMiscDiff: MiscModel[0].ViewMiscDiff,
            ViewMiscPGDiff: MiscModel[0].ViewMiscPGDiff,
            ViewMiscContact: MiscModel[0].ViewMiscContact,
            ViewMiscPhone: MiscModel[0].ViewMiscPhone,
            ViewMiscEmail: MiscModel[0].ViewMiscEmail,
            ViewMiscAddress: MiscModel[0].ViewMiscAddress,
            ViewMiscCity: MiscModel[0].ViewMiscCity,
            ViewMiscNotes: MiscModel[0].ViewMiscNotes,
            // search part
            MiscSearchStartFromDate: $("#MiscSearchStartFromDate").val(),
            MiscSearchStartToDate: $("#MiscSearchStartToDate").val(),
            MiscSearchCustomer: $("#MiscSearchCustomer").val(),
            MiscSearchGroupName: $("#MiscSearchGroupName").val(),
            MiscSearchGroupCode: $("#MiscSearchGroupCode").val(),
            MiscSearchVendorName: $("#MiscSearchVendorName").val(),
            MiscSearchEmployee: $("#MiscSearchEmployee").val(),
            MiscSearchEmployeeID: $("#MiscSearchEmployeeID").val(),
            // Filter part
            SelectedMiscFilterCustomerCode: SelectedMiscFilterCustomerCode.length > 0 ? SelectedMiscFilterCustomerCode : [],
            SelectedMiscFilterGroupName: SelectedMiscFilterGroupName.length > 0 ? SelectedMiscFilterGroupName : [],
            SelectedMiscFilterGroupCode: SelectedMiscFilterGroupCode.length > 0 ? SelectedMiscFilterGroupCode : [],
            SelectedMiscFilterVendorCity: SelectedMiscFilterVendorCity.length > 0 ? SelectedMiscFilterVendorCity : [],
            SelectedMiscFilterVendorName: SelectedMiscFilterVendorName.length > 0 ? SelectedMiscFilterVendorName : [],
            SelectedMiscFilterStatus: SelectedMiscFilterStatus.length > 0 ? SelectedMiscFilterStatus : [],
            // More and Scroll part
            MiscPageNumber: $("#MiscPageNumber").val(),
            IsMiscCanNext: $("#IsMiscCanNext").val(),
            IsMiscCanPrev: $("#IsMiscCanPrev").val(),
            MiscLeftScrollPossition: parseFloat($("#OperMiscGrid").scrollLeft()),
            MiscTopScrollPossition: parseFloat($("#OperMiscGrid").scrollTop()),
        };
        debugger
        var RowsValidate = $('#OperMiscGrid').find('.htInvalid');
        if (Rows.length > 1) {
            if (RowsValidate.length == 0) {
                var IsValidTime = true;
                var IsValidServiceDetail = true;
                $(Rows).each(function (index, elem) {
                    if (index < Rows.length - 1) {
                        var MiscStatus = MiscGetIDFromList(MiscModel[0].VendorStatus, elem.MiscSelectedVendorStatus);
                        if (MiscStatus == 2 && (elem.MiscTime == undefined || (elem.MiscTime != undefined && elem.MiscTime.length == 0))) {
                            IsValidTime = false;
                            return;
                        }
                        if (MiscStatus == 2 && (elem.MiscSelectedDetail == undefined || (elem.MiscSelectedDetail != undefined && elem.MiscSelectedDetail.length == 0))) {
                            IsValidServiceDetail = false;
                            return;
                        }
                        var RowItm = {
                            GroupID: elem.MiscGroupID,
                            VendorID: elem.MiscVendorID,
                            NewVendorID: elem.MiscNewVendorID,
                            QuotaCurr: elem.MiscQuotaCurr,
                            MiscSelectedVendorStatus: MiscGetIDFromList(MiscModel[0].VendorStatus, elem.MiscSelectedVendorStatus),
                            SelectedDetailID: MiscGetIDFromList(MiscModel[0].Details, elem.MiscSelectedDetail),
                            SelectedEmployeeID: MiscGetIDFromList(MiscModel[0].Employee, elem.MiscSelectedEmployee),
                            StartDate: (index < MiscOldDate.length) ? MiscOldDate[index] : null,
                            NewStartDate: elem.MiscDate,
                            Time: elem.MiscTime,
                            UnitPrice: elem.MiscUnitPrice,
                            UnitPricePG: elem.MiscUnitPricePG,
                            Plane: elem.MiscPlane,
                            Pax: elem.MiscPax,
                            IsComp: elem.MiscIsComp,
                            Notes: elem.MiscNotes,
                            FirstPayment: elem.MiscFirstPayment,
                            SelectedFirstPaymentMethod: elem.MiscSelectedFirstPaymentMethod,
                            DateFirstPayment: elem.MiscDateFirstPayment,
                            SecondPayment: elem.MiscSecondPayment,
                            SelectedSecondPaymentMethod: elem.MiscSelectedSecondPaymentMethod,
                            DateSecondPayment: elem.MiscDateSecondPayment,
                            ThirdPayment: elem.MiscThirdPayment,
                            SelectedThirdPaymentMethod: elem.MiscSelectedThirdPaymentMethod,
                            DateThirdPayment: elem.MiscDateThirdPayment,
                        };
                        OperationMiscGridViewModel.SaveRows.push(RowItm);
                    }
                });
                if (IsValidTime == false) {
                    jAlert("If vendor status made time can't be empty.", "Error!");
                    return;
                }
                if (IsValidServiceDetail == false) {
                    jAlert("If vendor status made service detail can't be empty.", "Error!");
                    return;
                }
                var DTO = JSON.stringify(OperationMiscGridViewModel);
                $.ajax({
                    url: urls["OperationMiscGridSave"],
                    type: 'POST',
                    contentType: 'application/json; charset=utf-8',
                    data: DTO,
                    success: function (data) {
                        $("#tabMisc").html(data);
                    },
                    error: function (xhr) {
                        //   alert('Error: ' + xhr.statusText);
                    },
                    complete: function () {
                        if ($("#MiscLeftScrollPossition").val() != "") {
                            $("#OperMiscGrid").scrollLeft(parseFloat($("#MiscLeftScrollPossition").val()));
                        }
                        if ($("#MiscTopScrollPossition").val() != "") {
                            $("#OperMiscGrid").scrollTop(parseFloat($("#MiscTopScrollPossition").val()));
                        }
                        OperTechProgSearch();
                        UpdateGrpProfits();
                    }
                });
            }
            else {
                jAlert("You have invalid data", "Error!");
            }
        }
        else {
            jAlert("You have not any data for save", "Error!");
        }

    }
    function MiscUpdateFormProp(LineNo, VendorID, Instance, row) {
        if (LineNo == 1) {
            Instance.getData()[row].MiscFirstPayment = $("#AuthorizedAmount").val();
            Instance.getData()[row].MiscDateFirstPayment = $("#Date").val();
            Instance.render();
        }
        if (LineNo == 2) {
            Instance.getData()[row].MiscSecondPayment = $("#AuthorizedAmount").val();
            Instance.getData()[row].MiscDateSecondPayment = $("#Date").val();
            Instance.render();
        }
        if (LineNo == 3) {
            Instance.getData()[row].MiscThirdPayment = $("#AuthorizedAmount").val();
            Instance.getData()[row].MiscDateThirdPayment = $("#Date").val();
            Instance.render();
        }
    }
    function MiscGetIDFromList(List, selItem) {
        var RetVal = 0;
        $(List).each(function (index, elem) {
            if (elem.Text == selItem)
                RetVal = parseInt(elem.Value);
        });
        return RetVal;
    }
    // toggle Search params
    function MiscSearchToggle() {
        if ($("#SearchMiscToggleDiv").hasClass("SearchHotelToggleDivMore")) {
            $("#SearchMiscToggleDiv").removeClass("SearchHotelToggleDivMore");
            $("#SearchMiscToggleDiv").addClass("SearchHotelToggleDivLess");
        }
        else {
            $("#SearchMiscToggleDiv").addClass("SearchHotelToggleDivMore");
            $("#SearchMiscToggleDiv").removeClass("SearchHotelToggleDivLess");
        }
        $("#OperSearchMisc").toggle(200);
    };
    $(document).on("copy", "#MiscGetSelected", function (e) {
        debugger
        MiscGetSelectedClick();
        var table = $("#MiscForEmail");
        e.clipboardData.clearData();
        e.clipboardData.setData("text/html", table.html());
        e.preventDefault();
        $("#MiscForEmail").remove();
        $("#MiscGetSelected").attr('disabled', true);

    });
    function RemoveMiscFilter(element) {
        debugger
        var columnFilter = $(element).attr('id');
        switch (columnFilter) {
            case "MiscRemoveCustomerFilter":
                {
                    $("#IsRemoveMiscCustomerCodeFilter").val("True");
                }
                break;
            case "MiscRemoveGroupCodeFilter":
                {
                    $("#IsRemoveMiscGroupCodeFilter").val("True");
                }
                break;
            case "MiscRemoveGroupNameFilter":
                {
                    $("#IsRemoveMiscGroupNameFilter").val("True");
                }
                break;
            case "MiscRemoveVendorNameFilter":
                {
                    $("#IsRemoveMiscVendorNameFilter").val("True");
                }
                break;
            case "MiscRemoveVendorCityFilter":
                {
                    $("#IsRemoveMiscVendorCityFilter").val("True");
                }
                break;
            case "MiscRemoveStatusFilter":
                {
                    $("#IsRemoveMiscStatusFilter").val("True");
                }
                break;
            default:
                break;
        }
        $("#MiscPageNumber").val(1);
        MiscPageNum = 1;
        $("#IsMiscFilter").val("True");
        isMiscFilter = "True";
        $("#MiscGridUpdate").click();
    }
</script>
<div class="OperationTabsTitleDiv">
    <span class="OperationTabsTitle">Misc</span>
</div>
@using (Ajax.BeginForm("SaveOperationMiscGridData", "Operation", new AjaxOptions() { HttpMethod = "Post", UpdateTargetId = "tabMisc", OnComplete = "MiscGridAjaxCompleted", InsertionMode = InsertionMode.Replace }, new { enctype = "multipart/form-data", id = "OperMiscGridForm" }))
{
    <div id="SearchMiscToggleDiv" class="SearchHotelToggleDivMore" onclick="MiscSearchToggle()"></div>
    <div id="OperSearchMisc" style="display: none; height: 100px; width:1185px; background-color: rgba(128, 128, 128, 0.8); ">
        <div class="pull-right" style="margin-left:25px; margin-bottom:15px;">

            <div class="row form-row">
                <div class=" col-lg-3">
                    <div class="input-group">
                        <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.MiscSearchStartFromDate)</span>
                        @Html.TextBoxFor(model => model.MiscSearchStartFromDate, new { @class = "form-control SearchDate table_inputs_SmallPadding2 inpputgr" })
                    </div>
                </div>
                <div class=" col-lg-3">
                    <div class="input-group">
                        <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.MiscSearchStartToDate)</span>
                        @Html.TextBoxFor(model => model.MiscSearchStartToDate, new { @class = "form-control SearchDate table_inputs_SmallPadding2 inpputgr" })
                    </div>
                </div>
                <div class=" col-lg-3">
                    <div class="input-group">
                        <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.MiscSearchGroupCode)</span>
                        @Html.TextBoxFor(model => model.MiscSearchGroupCode, new { @class = "TxtComplete form-control table_inputs_SmallPadding2 inpputgr" })
                    </div>
                </div>
                <div class=" col-lg-3">
                    <div class="input-group">
                        <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.MiscSearchGroupName)</span>
                        @Html.TextBoxFor(model => model.MiscSearchGroupName, new { @class = "TxtComplete form-control table_inputs_SmallPadding2 inpputgr" })
                    </div>
                </div>
            </div>
            <div class="row form-row">
                <div class=" col-lg-3">
                    <div class="input-group">
                        <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.MiscSearchCustomer)</span>
                        @Html.TextBoxFor(model => model.MiscSearchCustomer, new { @class = "TxtComplete form-control table_inputs_SmallPadding2 inpputgr" })
                    </div>
                </div>
                <div class=" col-lg-3">
                    <div class="input-group">
                        <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.MiscSearchVendorName)</span>
                        @Html.TextBoxFor(model => model.MiscSearchVendorName, new { @class = "TxtComplete form-control table_inputs_SmallPadding2 inpputgr" })
                    </div>
                </div>
                <div class=" col-lg-3">
                    <div class="input-group">
                        <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.MiscSearchEmployee)</span>
                        @Html.TextBoxFor(model => model.MiscSearchEmployee, new { @class = "TxtComplete form-control table_inputs_SmallPadding2 inpputgr Emp" })
                        @Html.HiddenFor(model=>model.MiscSearchEmployeeID)
                    </div>
                </div>
                <div class="pull-right col-lg-3">
                    <div class="pull-right input-group">
                        <input type="button" id="MiscGroupSearchBtn" onclick="MiscGroupSearchBtnClick()" class="btn14 pull-right" value="Search" style="margin-right:17px;">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="MiscGridMiscPlaneDiv" style="@(@Model.ViewMiscPlane ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Plane</span><div id="MiscGridMiscPlaneView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscIsCompDiv" style="@(@Model.ViewMiscIsComp ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Is Comp</span><div id="MiscGridMiscIsCompView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscGroupCodeDiv" style="@(@Model.ViewMiscGroupCode ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Group Code</span><div id="MiscGridMiscGroupCodeView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscConfHtmlDiv" style="@(@Model.ViewMiscConfHtml ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Details</span><div id="MiscGridMiscConfHtmlView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscGroupNameDiv" style="@(@Model.ViewMiscGroupName ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Group Name</span><div id="MiscGridMiscGroupNameView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscCustomerDiv" style="@(@Model.ViewMiscCustomer ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Customer</span><div id="MiscGridMiscCustomerView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscEmployeeDiv" style="@(@Model.ViewMiscEmployee ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Employee</span><div id="MiscGridMiscEmployeeView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
     <div id="MiscGridMiscServiceDetailDiv" style="@(@Model.ViewMiscServiceDetail ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Service Detail</span><div id="MiscGridMiscServiceDetailView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
     <div id="MiscGridMiscPaxDiv" style="@(@Model.ViewMiscPax ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Pax</span><div id="MiscGridMiscPaxView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscEstNumberofPersonDiv" style="@(@Model.ViewMiscEstNumberofPerson ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Est. Pax</span><div id="MiscGridMiscEstNumberofPersonView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscSupplierDiv" style="@(@Model.ViewMiscSupplier ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Supplier</span><div id="MiscGridMiscSupplierView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscDateDiv" style="@(@Model.ViewMiscDate ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Date</span><div id="MiscGridMiscDateView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscTimeDiv" style="@(@Model.ViewMiscTime ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Time</span><div id="MiscGridMiscTimeView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscUnitPriceDiv" style="@(@Model.ViewMiscUnitPrice ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Unit Price</span><div id="MiscGridMiscUnitPriceView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscUnitPricePGDiv" style="@(@Model.ViewMiscUnitPricePG ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Unit Price P/G</span><div id="MiscGridMiscUnitPricePGView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
     <div id="MiscGridMiscDiffDiv" style="@(@Model.ViewMiscDiff ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Diff</span><div id="MiscGridMiscDiffView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
     <div id="MiscGridMiscPGDiffDiv" style="@(@Model.ViewMiscPGDiff ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>P/G Diff</span><div id="MiscGridMiscPGDiffView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscContactDiv" style="@(@Model.ViewMiscContact ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Contact</span><div id="MiscGridMiscContactView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscPhoneDiv" style="@(@Model.ViewMiscPhone ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Phone</span><div id="MiscGridMiscPhoneView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscEmailDiv" style="@(@Model.ViewMiscEmail ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Email</span><div id="MiscGridMiscEmailView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscAddressDiv" style="@(@Model.ViewMiscAddress ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Address</span><div id="MiscGridMiscAddressView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscCityDiv" style="@(@Model.ViewMiscCity ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>City</span><div id="MiscGridMiscCityView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscStatusDiv" style="@(@Model.ViewMiscStatus ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Status</span><div id="MiscGridMiscStatusView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscCurrencyDiv" style="@(@Model.ViewMiscCurrency ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Currency</span><div id="MiscGridMiscCurrencyView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscTotalAmountPaidDiv" style="@(@Model.ViewMiscTotalAmountPaid ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Total Amount Paid</span><div id="MiscGridMiscTotalAmountPaidView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscTotalCostDiv" style="@(@Model.ViewMiscTotalCost ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Total Cost</span><div id="MiscGridMiscTotalCostView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscOutstandingAmtDiv" style="@(@Model.ViewMiscOutstandingAmt ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Outstanding Amount</span><div id="MiscGridMiscOutstandingAmtView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscFirstPaymentDiv" style="@(@Model.ViewMiscFirstPayment ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>1st Payment</span><div id="MiscGridMiscFirstPaymentView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscFirstPaymentMethodDiv" style="@(@Model.ViewMiscSelectedFirstPaymentMethod ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>1st Payment Method</span><div id="MiscGridMiscFirstPaymentMethodView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscDateFirstPaymentDiv" style="@(@Model.ViewMiscDateFirstPayment ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Date of 1st Payment</span><div id="MiscGridMiscDateFirstPaymentView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscSecondPaymentDiv" style="@(@Model.ViewMiscSecondPayment ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>2nd Payment</span><div id="MiscGridMiscSecondPaymentView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscSecondPaymentMethodDiv" style="@(@Model.ViewMiscSelectedSecondPaymentMethod ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>2nd Payment Method</span><div id="MiscGridMiscSecondPaymentMethodView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscDateSecondPaymentDiv" style="@(@Model.ViewMiscDateSecondPayment ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Date of 2nd Payment</span><div id="MiscGridMiscDateSecondPaymentView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscThirdPaymentDiv" style="@(@Model.ViewMiscThirdPayment ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>3rd Payment</span><div id="MiscGridMiscThirdPaymentView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscThirdPaymentMethodDiv" style="@(@Model.ViewMiscSelectedThirdPaymentMethod ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>3rd Payment Method</span><div id="MiscGridMiscThirdPaymentMethodView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscDateThirdPaymentDiv" style="@(@Model.ViewMiscDateThirdPayment ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Date of 3rd Payment</span><div id="MiscGridMiscDateThirdPaymentView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscQuotaPriceDiv" style="@(@Model.ViewMiscQuotaPrice ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Quota Price</span><div id="MiscGridMiscQuotaPriceView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscQuotaPerGroupPriceDiv" style="@(@Model.ViewMiscQuotaPerGroupPrice ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Quota Price P/G</span><div id="MiscGridMiscQuotaPerGroupPriceView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscQuotaSupplierDiv" style="@(@Model.ViewMiscQuotaSupplier ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Quota Supplier</span><div id="MiscGridMiscQuotaSupplierView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscGridMiscNotesDiv" style="@(@Model.ViewMiscNotes ? "display:none" : "")">
        <div class="MiscGridViewBtnDiv">
            <span>Notes</span><div id="MiscGridMiscNotesView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
        </div>
    </div>
    <div id="MiscRemoveFiltersDiv" class="MiscRemoveFiltersDiv" style="display:none">
        <span class="MiscRemoveFiltersSpan">Filters :</span>
        @if (Model.MiscFilterSelGroupCode != null)
        {
            if (Model.MiscFilterSelGroupCode.Count > 0)
            {
                <div class="MiscGridViewBtnDiv"><span>Group Code</span><div id="MiscRemoveGroupCodeFilter" class="MiscGridViewBtn" onclick="RemoveMiscFilter(this)"></div></div>
                Model.IsRemoveMiscFilterDivShow = true;
            }
        }
        @if (Model.MiscFilterSelGroupName != null)
        {
            if (Model.MiscFilterSelGroupName.Count > 0)
            {
                <div class="MiscGridViewBtnDiv"><span>Group Name</span><div id="MiscRemoveGroupNameFilter" class="MiscGridViewBtn" onclick="RemoveMiscFilter(this)"></div></div>
                Model.IsRemoveMiscFilterDivShow = true;
            }
        }
        @if (Model.MiscFilterSelCustomerCode != null)
        {
            if (Model.MiscFilterSelCustomerCode.Count > 0)
            {
                <div class="MiscGridViewBtnDiv"><span>Customer</span><div id="MiscRemoveCustomerFilter" class="MiscGridViewBtn" onclick="RemoveMiscFilter(this)"></div></div>
                Model.IsRemoveMiscFilterDivShow = true;
            }
        }
        @if (Model.MiscFilterSelStatus != null)
        {
            if (Model.MiscFilterSelStatus.Count > 0)
            {
                <div class="MiscGridViewBtnDiv"><span>Status</span><div id="MiscRemoveStatusFilter" class="MiscGridViewBtn" onclick="RemoveMiscFilter(this)"></div></div>
                Model.IsRemoveMiscFilterDivShow = true;
            }
        }
        @if (Model.MiscFilterSelVendorName != null)
        {
            if (Model.MiscFilterSelVendorName.Count > 0)
            {
                <div class="MiscGridViewBtnDiv"><span>Supplier</span><div id="MiscRemoveVendorNameFilter" class="MiscGridViewBtn" onclick="RemoveMiscFilter(this)"></div></div>
                Model.IsRemoveMiscFilterDivShow = true;
            }
        }
        @if (Model.MiscFilterSelVendorCity != null)
        {
            if (Model.MiscFilterSelVendorCity.Count > 0)
            {
                <div class="MiscGridViewBtnDiv"><span>City</span><div id="MiscRemoveVendorCityFilter" class="MiscGridViewBtn" onclick="RemoveMiscFilter(this)"></div></div>
                Model.IsRemoveMiscFilterDivShow = true;
            }
        }
    </div>
    <div id="OperMiscGridFilters" style="width:1200px; float:left; padding-top:12px; padding-right:5px; padding-bottom:8px;">
        <div id="MiscGridGroupCodeMainDiv" class="MiscGridFilterDiv">
            <div class="MiscGridFilterDivClose"></div>
            @Html.CheckBoxListFor(model => model.SelectedMiscFilterGroupCode,
                                      model => model.MiscFilterGroupCode,
                                      grp => grp.Id,
                                      grp => grp.Name,
                                      model => model.MiscFilterSelGroupCode,
                                      MvcCheckBoxList.Model.Position.Vertical)
        </div>
        <div id="MiscGridGroupNameMainDiv" class="MiscGridFilterDiv">
            <div class="MiscGridFilterDivClose"></div>
            @Html.CheckBoxListFor(model => model.SelectedMiscFilterGroupName,
                                      model => model.MiscFilterGroupName,
                                      grp => grp.Id,
                                      grp => grp.Name,
                                      model => model.MiscFilterSelGroupName,
                                      MvcCheckBoxList.Model.Position.Vertical)
        </div>
        <div id="MiscGridCustomerCodeMainDiv" class="MiscGridFilterDiv">
            <div class="MiscGridFilterDivClose"></div>
            @Html.CheckBoxListFor(model => model.SelectedMiscFilterCustomerCode,
                                      model => model.MiscFilterCustomerCode,
                                      grp => grp.Id,
                                      grp => grp.Name,
                                      model => model.MiscFilterSelCustomerCode,
                                      MvcCheckBoxList.Model.Position.Vertical)
        </div>
        <div id="MiscGridStatusMainDiv" class="MiscGridFilterDiv">
            <div class="MiscGridFilterDivClose"></div>
            @Html.CheckBoxListFor(model => model.SelectedMiscFilterStatus,
                                      model => model.MiscFilterStatus,
                                      grp => grp.Id,
                                      grp => grp.Name,
                                      model => model.MiscFilterSelStatus,
                                      MvcCheckBoxList.Model.Position.Vertical)
        </div>
        <div id="MiscGridVendorNameMainDiv" class="MiscGridFilterDiv">
            <div class="MiscGridFilterDivClose"></div>
            @Html.CheckBoxListFor(model => model.SelectedMiscFilterVendorName,
                                      model => model.MiscFilterVendorName,
                                      grp => grp.Id,
                                      grp => grp.Name,
                                      model => model.MiscFilterSelVendorName,
                                      MvcCheckBoxList.Model.Position.Vertical)
        </div>
        <div id="MiscGridVendorCityMainDiv" class="MiscGridFilterDiv">
            <div class="MiscGridFilterDivClose"></div>
            @Html.CheckBoxListFor(model => model.SelectedMiscFilterVendorCity,
                                      model => model.MiscFilterVendorCity,
                                      grp => grp.Id,
                                      grp => grp.Name,
                                      model => model.MiscFilterSelVendorCity,
                                      MvcCheckBoxList.Model.Position.Vertical)
        </div>
    </div>
    <div style="display:none;">
        <div id="MiscPlaneDiv">
            <div class="OperationHotelGroupInfo">
                <span>Flight</span>
                @Html.HiddenFor(model => model.ViewMiscPlane)
                <div id="MiscGridMiscPlaneView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscIsCompDiv">
            <div class="OperationHotelVendorInfo">
                <span>Is Comp</span>
                @Html.HiddenFor(model => model.ViewMiscIsComp)
                <div id="MiscGridMiscIsCompView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscGroupCodeDiv">
            <div class="OperationHotelGroupInfo">
                <span>Group Code</span>
                @Html.HiddenFor(model => model.ViewMiscGroupCode)
                <div id="MiscGridMiscGroupCodeView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
                @if (@Model.OperationMiscGroupCodeFilter)
                {
                    <div class="MiscGridFilterBtn" id="MiscGridGroupCode"></div>
                }
            </div>
        </div>
        <div id="MiscConfHtmlDiv">
            <div class="OperationHotelVendorInfo">
                <span>Details</span>
                @Html.HiddenFor(model => model.ViewMiscConfHtml)
                <div id="MiscGridMiscConfHtmlView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscGroupNameDiv">
            <div class="OperationHotelGroupInfo">
                <span>Group Name</span>
                @Html.HiddenFor(model => model.ViewMiscGroupName)
                <div id="MiscGridMiscGroupNameView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
                @if (@Model.OperationMiscGroupNameFilter)
                {
                    <div class="MiscGridFilterBtn" id="MiscGridGroupName"></div>
                }
            </div>
        </div>
        <div id="MiscCustomerDiv">
            <div class="OperationHotelGroupInfo">
                <span>Customer</span>
                @Html.HiddenFor(model => model.ViewMiscCustomer)
                <div id="MiscGridMiscCustomerView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
                @if (@Model.OperationMiscCustomerFilter)
                {
                    <div class="MiscGridFilterBtn" id="MiscGridCustomerCode"></div>
                }
            </div>
        </div>
        <div id="MiscEmployeeDiv">
            <div class="OperationHotelGroupInfo">
                <span>Employee</span>
                @Html.HiddenFor(model => model.ViewMiscEmployee)
                <div id="MiscGridMiscEmployeeView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscServiceDetailDiv">
            <div class="OperationHandsontable">
                <span>Service Detail</span>
                @Html.HiddenFor(model => model.ViewMiscServiceDetail)
                <div id="MiscGridMiscServiceDetailView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscPaxDiv">
            <div class="OperationHotelGroupInfo">
                <span>Pax</span>
                @Html.HiddenFor(model => model.ViewMiscPax)
                <div id="MiscGridMiscPaxView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscEstNumberofPersonDiv">
            <div class="OperationHotelGroupInfo">
                <span>Est. Pax</span>
                @Html.HiddenFor(model => model.ViewMiscEstNumberofPerson)
                <div id="MiscGridMiscEstNumberofPersonView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscStatusDiv">
            <div class="OperationHotelVendorInfo">
                <span>Status</span>
                @Html.HiddenFor(model => model.ViewMiscStatus)
                <div id="MiscGridMiscStatusView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
                @if (@Model.OperationMiscStatusFilter)
                {
                    <div class="MiscGridFilterBtn" id="MiscGridStatus"></div>
                }
            </div>
        </div>
        <div id="MiscSupplierDiv">
            <div class="OperationHotelVendorInfo">
                <span>Supplier</span>
                @Html.HiddenFor(model => model.ViewMiscSupplier)
                <div id="MiscGridMiscSupplierView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
                @if (@Model.OperationMiscSupplierFilter)
                {
                    <div class="MiscGridFilterBtn" id="MiscGridVendorName"></div>
                }
            </div>
        </div>
        <div id="MiscCurrencyDiv">
            <div class="OperationHotelQuotaInfo">
                <span>Currency</span>
                @Html.HiddenFor(model => model.ViewMiscCurrency)
                <div id="MiscGridMiscCurrencyView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscTotalAmountPaidDiv">
            <div class="OperationHotelTotals">
                <span>Total Amount Paid</span>
                @Html.HiddenFor(model => model.ViewMiscTotalAmountPaid)
                <div id="MiscGridMiscTotalAmountPaidView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscTotalCostDiv">
            <div class="OperationHotelTotals">
                <span>Total Cost</span>
                @Html.HiddenFor(model => model.ViewMiscTotalCost)
                <div id="MiscGridMiscTotalCostView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscOutstandingAmtDiv">
            <div class="OperationHotelTotals">
                <span>Outstanding Amount</span>
                @Html.HiddenFor(model => model.ViewMiscOutstandingAmt)
                <div id="MiscGridMiscOutstandingAmtView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscFirstPaymentDiv">
            <div class="OperationHotelPayments">
                <span>1st Payment</span>
                @Html.HiddenFor(model => model.ViewMiscFirstPayment)
                <div id="MiscGridMiscFirstPaymentView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscFirstPaymentMethodDiv">
            <div class="OperationHotelPayments">
                <span>1st Payment Method</span>
                @Html.HiddenFor(model => model.ViewMiscSelectedFirstPaymentMethod)
                <div id="MiscGridMiscFirstPaymentMethodView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscPayMeth1FormHtmlDiv">
            <div class="OperationHotelPayments">
                <span>Pay 1 Details</span>
            </div>
        </div>
        <div id="MiscDateFirstPaymentDiv">
            <div class="OperationHotelPayments">
                <span>Date of 1st Payment</span>
                @Html.HiddenFor(model => model.ViewMiscDateFirstPayment)
                <div id="MiscGridMiscDateFirstPaymentView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscSecondPaymentDiv">
            <div class="OperationHotelPayments">
                <span>2nd Payment</span>
                @Html.HiddenFor(model => model.ViewMiscSecondPayment)
                <div id="MiscGridMiscSecondPaymentView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscSecondPaymentMethodDiv">
            <div class="OperationHotelPayments">
                <span>2nd Payment Method</span>
                @Html.HiddenFor(model => model.ViewMiscSelectedSecondPaymentMethod)
                <div id="MiscGridMiscSecondPaymentMethodView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscPayMeth2FormHtmlDiv">
            <div class="OperationHotelPayments">
                <span>Pay 2 Details</span>
            </div>
        </div>
        <div id="MiscDateSecondPaymentDiv">
            <div class="OperationHotelPayments">
                <span>Date of 2nd Payment</span>
                @Html.HiddenFor(model => model.ViewMiscDateSecondPayment)
                <div id="MiscGridMiscDateSecondPaymentView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscThirdPaymentDiv">
            <div class="OperationHotelPayments">
                <span>3rd Payment</span>
                @Html.HiddenFor(model => model.ViewMiscThirdPayment)
                <div id="MiscGridMiscThirdPaymentView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscThirdPaymentMethodDiv">
            <div class="OperationHotelPayments">
                <span>3rd Payment Method</span>
                @Html.HiddenFor(model => model.ViewMiscSelectedThirdPaymentMethod)
                <div id="MiscGridMiscThirdPaymentMethodView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscPayMeth3FormHtmlDiv">
            <div class="OperationHotelPayments">
                <span>Pay 3 Details</span>
            </div>
        </div>
        <div id="MiscDateThirdPaymentDiv">
            <div class="OperationHotelPayments">
                <span>Date of 3rd Payment</span>
                @Html.HiddenFor(model => model.ViewMiscDateThirdPayment)
                <div id="MiscGridMiscDateThirdPaymentView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscQuotaPriceDiv">
            <div class="OperationHotelQuotaInfo">
                <span>Quota Price P/P</span>
                @Html.HiddenFor(model => model.ViewMiscQuotaPrice)
                <div id="MiscGridMiscQuotaPriceView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscQuotaPerGroupPriceDiv">
            <div class="OperationHotelQuotaInfo">
                <span>Quota Price P/G</span>
                @Html.HiddenFor(model => model.ViewMiscQuotaPerGroupPrice)
                <div id="MiscGridMiscQuotaPerGroupPriceView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscQuotaSupplierDiv">
            <div class="OperationHotelQuotaInfo">
                <span>Quota Supplier</span>
                @Html.HiddenFor(model => model.ViewMiscQuotaSupplier)
                <div id="MiscGridMiscQuotaSupplierView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscDateDiv">
            <div class="OperationHotelGroupInfo">
                <span>Date</span>
                @Html.HiddenFor(model => model.ViewMiscDate)
                <div id="MiscGridMiscDateView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscTimeDiv">
            <div class="OperationHotelGroupInfo">
                <span>Time</span>
                @Html.HiddenFor(model => model.ViewMiscTime)
                <div id="MiscGridMiscTimeView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscUnitPriceDiv">
            <div class="OperationHotelVendorInfo">
                <span>Unit Price P/P</span>
                @Html.HiddenFor(model => model.ViewMiscUnitPrice)
                <div id="MiscGridMiscUnitPriceView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscUnitPricePGDiv">
            <div class="OperationHotelVendorInfo">
                <span>Unit Price P/G</span>
                @Html.HiddenFor(model => model.ViewMiscUnitPricePG)
                <div id="MiscGridMiscUnitPricePGView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscDiffDiv">
            <div class="OperationHotelTotals">
                <span>Diff P/P</span>
                @Html.HiddenFor(model => model.ViewMiscDiff)
                <div id="MiscGridMiscDiffView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscPGDiffDiv">
            <div class="OperationHotelTotals">
                <span>Diff P/G</span>
                @Html.HiddenFor(model => model.ViewMiscPGDiff)
                <div id="MiscGridMiscPGDiffView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscContactDiv">
            <div class="OperationHotelVendorInfo">
                <span>Contact</span>
                @Html.HiddenFor(model => model.ViewMiscContact)
                <div id="MiscGridMiscContactView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscPhoneDiv">
            <div class="OperationHotelVendorInfo">
                <span>Phone</span>
                @Html.HiddenFor(model => model.ViewMiscPhone)
                <div id="MiscGridMiscPhoneView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscEmailDiv">
            <div class="OperationHotelVendorInfo">
                <span>Email</span>
                @Html.HiddenFor(model => model.ViewMiscEmail)
                <div id="MiscGridMiscEmailView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscAddressDiv">
            <div class="OperationHotelVendorInfo">
                <span>Address</span>
                @Html.HiddenFor(model => model.ViewMiscAddress)
                <div id="MiscGridMiscAddressView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="MiscCityDiv">
            <div class="OperationHotelVendorInfo">
                <span>City</span>
                @Html.HiddenFor(model => model.ViewMiscCity)
                <div id="MiscGridMiscCityView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
                @if (@Model.OperationMiscCityFilter)
                {
                    <div class="MiscGridFilterBtn" id="MiscGridVendorCity"></div>
                }
            </div>
        </div>
        <div id="MiscGroupContractHtmlDiv">
            <div class="OperationHotelVendorInfo">
                <span>View Vendor Contract</span>
            </div>
        </div>
        <div id="MiscNotesDiv">
            <div class="OperationHandsontable">
                <span>Notes</span>
                @Html.HiddenFor(model => model.ViewMiscNotes)
                <div id="MiscGridMiscNotesView" class="MiscGridViewBtn" onclick="MiscGridColumnHideUnhide(this)"></div>
            </div>
        </div>
    </div>
    <div id="OperMiscGrid" class="handsontable" style="width: 1185px; height:420px; overflow:auto;"></div>
    @Html.HiddenFor(model => model.MiscPageNumber)
    @Html.HiddenFor(model => model.IsMiscFilter)
    @Html.HiddenFor(model => model.IsMiscSearch)
    @Html.HiddenFor(model => model.IsMiscView)
    @Html.HiddenFor(model => model.IsMiscCanNext)
    @Html.HiddenFor(model => model.IsMiscCanPrev)
    @Html.HiddenFor(model => model.MiscLeftScrollPossition)
    @Html.HiddenFor(model => model.MiscTopScrollPossition)

    @Html.HiddenFor(model => model.IsRemoveMiscFilterDivShow)
    @Html.HiddenFor(model => model.IsRemoveMiscCustomerCodeFilter)
    @Html.HiddenFor(model => model.IsRemoveMiscGroupCodeFilter)
    @Html.HiddenFor(model => model.IsRemoveMiscGroupNameFilter)
    @Html.HiddenFor(model => model.IsRemoveMiscVendorNameFilter)
    @Html.HiddenFor(model => model.IsRemoveMiscVendorCityFilter)
    @Html.HiddenFor(model => model.IsRemoveMiscStatusFilter)
    
    @Html.HiddenFor(model => model.MiscTotCost)
    @Html.HiddenFor(model => model.MiscTotCostCad)
    <div style="width:100%;height:25px;text-align:center;margin-top:15px;float:right">
        @if (Model.IsMiscCanPrev)
        {
            <input type="button" id="MiscPrevBtn" onclick="MiscPrevBtnClick()" class="btn14" value="Prev" style="margin-left:10px;">
        }
        else
        {
            <input type="button" id="MiscMoreBtn" onclick="MiscPrevBtnClick()" class="btn14" value="Prev" disabled="disabled" style="margin-left:10px;">
        }
        <span style="padding-left:15px;padding-right:15px">@Html.LabelForModel(Model.MiscCount)</span>
        @if (Model.IsMiscCanNext)
        {
            <input type="button" id="MiscMoreBtn" onclick="MiscNextBtnClick()" class="btn14" value="Next" style="margin-left:10px;">
        }
        else
        {
            <input type="button" id="MiscMoreBtn" onclick="MiscNextBtnClick()" class="btn14" value="Next" disabled="disabled" style="margin-left:10px;">
        }
    </div>
    if (Model.OperationPLMiscView)
    {
        <div class="OperationTabsTitleDiv">
            <span class="OperationTabsTitle">Misc P/L</span>
        </div>
        if (Model.OperationPLMiscTotalPaidView || Model.OperationPLMiscTotalDiffView || Model.OperationPLMiscTotalPGDiffView)
        { 
            <div class="row form-row" style="@(@Model.Rows != null && @Model.Rows.Count > 0 ? "" : "display:none");width:840px !important;float:left !important;margin-left:10px !important;">
                @if (Model.OperationPLMiscTotalPaidView)
                {
                <div class=" col-lg-4 withoutPadding" style="width: 33%;">
                    <div class="input-group">
                        <span class="input-group-addon SumControlsLabelFSize">@Html.LabelFor(model => model.MiscTotalPaidSum)</span>
                        @Html.Raw(Model.MiscTotalPaidSum)
                    </div>
                </div>
                }
                @if (Model.OperationPLMiscTotalDiffView)
                { 
                    <div class=" col-lg-4 withoutPadding" style="width: 32%; margin-left: 10px">
                        <div class="input-group">
                            <span class="input-group-addon SumControlsLabelFSize">@Html.LabelFor(model => model.MiscDifferenceSum)</span>
                            @Html.Raw(Model.MiscDifferenceSum)
                        </div>
                    </div>
                }
                @if (Model.OperationPLMiscTotalPGDiffView)
                { 
                    <div class=" col-lg-4 withoutPadding" style="width:32%; margin-left:10px">
                        <div class="input-group">
                            <span class="input-group-addon SumControlsLabelFSize">@Html.LabelFor(model => model.MiscPGDifferenceSum)</span>
                            @Html.Raw(Model.MiscPGDifferenceSum)
                        </div>
                    </div>
                }
            </div>
        }
        if (Model.OperationPLMiscTotalCompView || Model.OperationPLMiscTotalPGCompView)
        { 
            <div class="row form-row" style="@(@Model.Rows != null && @Model.Rows.Count > 0 ? "" : "display:none");width:840px !important;float:left !important;margin-left:10px !important;">
                @if (Model.OperationPLMiscTotalCompView)
                { 
                    <div class=" col-lg-4 withoutPadding" style="width: 49%">
                        <div class="input-group">
                            <span class="input-group-addon SumControlsLabelFSize">@Html.LabelFor(model => model.MiscCompSum)</span>
                            @Html.Raw(Model.MiscCompSum)
                        </div>
                    </div>
                }
                @if (Model.OperationPLMiscTotalPGCompView)
                { 
                    <div class=" col-lg-4 withoutPadding" style="width:49%; margin-left:10px">
                        <div class="input-group">
                            <span class="input-group-addon SumControlsLabelFSize">@Html.LabelFor(model => model.MiscPGCompSum)</span>
                            @Html.Raw(Model.MiscPGCompSum)
                        </div>
                    </div>
                }
            </div>
        }
        if (Model.OperationPLMiscTotalCostView || Model.OperationPLMiscTotalOutAmtView)
        { 
            <div class="row form-row" style="@(@Model.Rows != null && @Model.Rows.Count > 0 ? "" : "display:none");width:840px !important;float:left !important;margin-left:10px !important;">
                @if (Model.OperationPLMiscTotalCostView)
                { 
                    <div class=" col-lg-4 withoutPadding" style="width: 49%">
                        <div class="input-group">
                            <span class="input-group-addon SumControlsLabelFSize">@Html.LabelFor(model => model.MiscTotalCostAmtSum)</span>
                            @Html.Raw(Model.MiscTotalCostAmtSum)
                        </div>
                    </div>
                }
                @if (Model.OperationPLMiscTotalOutAmtView)
                { 
                    <div class=" col-lg-4 withoutPadding" style="width:49%; margin-left:10px">
                        <div class="input-group">
                            <span class="input-group-addon SumControlsLabelFSize">@Html.LabelFor(model => model.MiscOutstandingAmtSum)</span>
                            @Html.Raw(Model.MiscOutstandingAmtSum)
                        </div>
                    </div>
                }
            </div>
        }
         if (Model.OperationPLHotelGrpProfitView )
        {
            <div class="row form-row" style="@(@Model.Rows != null && @Model.Rows.Count > 0 ? "" : "display:none");width:840px !important;float:left !important;margin-left:10px !important;">
                   <div class=" col-lg-2 withoutPadding" style="width:33% !important;">
                       <div class="input-group">
                           <span class="input-group-addon SumControlsLabelFSize">@Html.LabelFor(model => model.MiscGroupProfit)</span>
                           @Html.Raw(Model.MiscGroupProfit)
                       </div>
                   </div>

                   <div class=" col-lg-2 withoutPadding" style="width: 32% !important; margin-left: 10px;">
                       <div class="input-group">
                           <span class="input-group-addon SumControlsLabelFSize">@Html.LabelFor(model => model.MiscProfitPers)</span>
                           @Html.Raw(Model.MiscProfitPers)
                       </div>
                   </div>
                   
                   <div class=" col-lg-2 withoutPadding" style="width: 32% !important; margin-left: 10px;">
                       <div class="input-group">
                           <span class="input-group-addon SumControlsLabelFSize">@Html.LabelFor(model => model.MiscTotInvoice)</span>
                           @Html.Raw(Model.MiscTotInvoice)
                       </div>
                   </div>
            </div>
        }
    }
    <div style="width:330px;height:25px;text-align:center;margin-top:15px;float:right">
        <div style="margin:0">
            <button class="btn14 pull-right" id="OperMiscSaveBtn" style="margin-left:10px;" onclick="MiscGridSave()" type="button">Save</button>
            <input type="button" id="MiscGetSelected" class="btn14 btn120 pull-right" value="Copy For Email" disabled="disabled">
        </div>
    </div>
    <button style="display:none;" id="MiscGridUpdate" type="submit"></button>
}





